from aip import AipNlp
import json

""" 你的 APPID AK SK """
APP_ID = '20473221'
API_KEY = 'SFBpbdIXfPk1ppH7iGv7HhsB'
SECRET_KEY = '4KVrvCdsXpdE55GGz1AjlyBM4gUfjEOS'

def request(text):
    client = AipNlp(APP_ID, API_KEY, SECRET_KEY)
    ##调用词法分析
    data = client.lexer(text)
    return data

def requestWordSimEmbedding(word1,word2):
    client = AipNlp(APP_ID, API_KEY, SECRET_KEY)
    data = client.wordSimEmbedding(word1, word2)
    return data

def requestSimnet(word1,word2):
    client = AipNlp(APP_ID, API_KEY, SECRET_KEY)
    data = client.simnet(word1, word2)
    return data

if __name__ == "__main__":
    # data = request("模棱两可的,不清楚的,有歧义的")
    data = requestWordSimEmbedding("cab","ambulance")
    print(data)